﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using RrslLite.Net.Attributes;
using RrslLite.Net.Messages;

namespace RrslLite.Net.Contracts
{

    [ServiceContractAttribute(ConfigurationName = "RrslLite.Net.Contracts.IWcfDuplexMessageService", CallbackContract = typeof(IAsyncWcfDuplexMessageServiceCallback))]
    public interface IAsyncWcfDuplexMessageService
    {
        [OperationContract(AsyncPattern = true, Name = "InvokeOperations", Action = "http://tempuri.org/IWcfDuplexMessageService/InvokeOperations")]
        [ServiceKnownType("GetKnownTypes", typeof(KnownTypeProvider))]
        IAsyncResult BeginInvokeOperations(Message[] messages, System.AsyncCallback callback, object asyncState);

        void EndInvokeOperations(System.IAsyncResult result);

        event EventHandler<InvokeOperationsAsyncCompletedArgs> ReceiveReceived;

        //event EventHandler Closed;
        //event EventHandler Closing;
        event EventHandler Faulted;
        //event EventHandler Opened;
        //event EventHandler Opening;

        CommunicationState State { get; }
    }

    public interface IAsyncWcfDuplexMessageServiceCallback
    {
        [OperationContractAttribute(IsOneWay = true, Action = "http://tempuri.org/IWcfDuplexMessageService/Receive")]
        [ServiceKnownType("GetKnownTypes", typeof(KnownTypeProvider))]
        void Receive(Message[] messages);
    }
}
